package com.mrx.wallabagserver.controller;

import com.mrx.wallabagserver.model.oauth.OAuthRequest;
import com.mrx.wallabagserver.model.oauth.OAuthResponse;
import com.mrx.wallabagserver.service.OAuthService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.X
 * @since 2024-03-15 09:08
 **/
@RestController
@RequestMapping("/oauth/v2")
public class OAuthController {

    @Resource
    private OAuthService oAuthService;

    @PostMapping("/token")
    public OAuthResponse token(@RequestBody OAuthRequest request) {
        return oAuthService.generateToken(request);
    }

}
